/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BD;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ARMGARCES
 */
@Entity
@Table(name = "itemoc_mp")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ItemocMp.findAll", query = "SELECT i FROM ItemocMp i"),
    @NamedQuery(name = "ItemocMp.findByIdItemOCmp", query = "SELECT i FROM ItemocMp i WHERE i.idItemOCmp = :idItemOCmp"),
    @NamedQuery(name = "ItemocMp.findByUnidad", query = "SELECT i FROM ItemocMp i WHERE i.unidad = :unidad"),
    @NamedQuery(name = "ItemocMp.findByCantidad", query = "SELECT i FROM ItemocMp i WHERE i.cantidad = :cantidad"),
    @NamedQuery(name = "ItemocMp.findByPrecio", query = "SELECT i FROM ItemocMp i WHERE i.precio = :precio"),
    @NamedQuery(name = "ItemocMp.findByTotal", query = "SELECT i FROM ItemocMp i WHERE i.total = :total"),
    @NamedQuery(name = "ItemocMp.findByPedido", query = "SELECT i FROM ItemocMp i WHERE i.pedido = :pedido"),
    @NamedQuery(name = "ItemocMp.findByRecibido", query = "SELECT i FROM ItemocMp i WHERE i.recibido = :recibido")})
public class ItemocMp implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idItemOC_mp")
    private Integer idItemOCmp;
    @Basic(optional = false)
    @Column(name = "unidad")
    private int unidad;
    @Basic(optional = false)
    @Column(name = "cantidad")
    private int cantidad;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @Column(name = "precio")
    private BigDecimal precio;
    @Basic(optional = false)
    @Column(name = "total")
    private BigDecimal total;
    @Basic(optional = false)
    @Column(name = "pedido")
    private int pedido;
    @Basic(optional = false)
    @Column(name = "recibido")
    private int recibido;
    @JoinColumn(name = "fk_idMateriaPrima", referencedColumnName = "idMateriaPrima")
    @ManyToOne(optional = false)
    private Materiaprima fkidMateriaPrima;
    @JoinColumn(name = "fk_idOrdenCompra_mp", referencedColumnName = "idOrdenCompra_mp")
    @ManyToOne(optional = false)
    private OrdencompraMp fkidOrdenCompramp;

    public ItemocMp() {
    }

    public ItemocMp(Integer idItemOCmp) {
        this.idItemOCmp = idItemOCmp;
    }

    public ItemocMp(Integer idItemOCmp, int unidad, int cantidad, BigDecimal precio, BigDecimal total, int pedido, int recibido) {
        this.idItemOCmp = idItemOCmp;
        this.unidad = unidad;
        this.cantidad = cantidad;
        this.precio = precio;
        this.total = total;
        this.pedido = pedido;
        this.recibido = recibido;
    }

    public Integer getIdItemOCmp() {
        return idItemOCmp;
    }

    public void setIdItemOCmp(Integer idItemOCmp) {
        this.idItemOCmp = idItemOCmp;
    }

    public int getUnidad() {
        return unidad;
    }

    public void setUnidad(int unidad) {
        this.unidad = unidad;
    }

    public int getCantidad() {
        return cantidad;
    }

    public void setCantidad(int cantidad) {
        this.cantidad = cantidad;
    }

    public BigDecimal getPrecio() {
        return precio;
    }

    public void setPrecio(BigDecimal precio) {
        this.precio = precio;
    }

    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    public int getPedido() {
        return pedido;
    }

    public void setPedido(int pedido) {
        this.pedido = pedido;
    }

    public int getRecibido() {
        return recibido;
    }

    public void setRecibido(int recibido) {
        this.recibido = recibido;
    }

    public Materiaprima getFkidMateriaPrima() {
        return fkidMateriaPrima;
    }

    public void setFkidMateriaPrima(Materiaprima fkidMateriaPrima) {
        this.fkidMateriaPrima = fkidMateriaPrima;
    }

    public OrdencompraMp getFkidOrdenCompramp() {
        return fkidOrdenCompramp;
    }

    public void setFkidOrdenCompramp(OrdencompraMp fkidOrdenCompramp) {
        this.fkidOrdenCompramp = fkidOrdenCompramp;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idItemOCmp != null ? idItemOCmp.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemocMp)) {
            return false;
        }
        ItemocMp other = (ItemocMp) object;
        if ((this.idItemOCmp == null && other.idItemOCmp != null) || (this.idItemOCmp != null && !this.idItemOCmp.equals(other.idItemOCmp))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "BD.ItemocMp[ idItemOCmp=" + idItemOCmp + " ]";
    }
    
}
